/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.biblio.persistencias;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Héctor <UFG>
 */
@Entity
@Table(name = "multa_tipo", catalog = "mydb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MultaTipo.findAll", query = "SELECT m FROM MultaTipo m"),
    @NamedQuery(name = "MultaTipo.findByMtId", query = "SELECT m FROM MultaTipo m WHERE m.mtId = :mtId"),
    @NamedQuery(name = "MultaTipo.findByMtNombre", query = "SELECT m FROM MultaTipo m WHERE m.mtNombre = :mtNombre"),
    @NamedQuery(name = "MultaTipo.findByMtCosto", query = "SELECT m FROM MultaTipo m WHERE m.mtCosto = :mtCosto")})
public class MultaTipo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "mt_id")
    private Integer mtId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "mt_nombre", nullable = false, length = 20)
    private String mtNombre;
    @Basic(optional = false)
    @NotNull
    @Column(name = "mt_costo", nullable = false)
    private double mtCosto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "multaMtId")
    private List<Multa> multaList;

    public MultaTipo() {
    }

    public MultaTipo(Integer mtId) {
        this.mtId = mtId;
    }

    public MultaTipo(Integer mtId, String mtNombre, double mtCosto) {
        this.mtId = mtId;
        this.mtNombre = mtNombre;
        this.mtCosto = mtCosto;
    }

    public Integer getMtId() {
        return mtId;
    }

    public void setMtId(Integer mtId) {
        this.mtId = mtId;
    }

    public String getMtNombre() {
        return mtNombre;
    }

    public void setMtNombre(String mtNombre) {
        this.mtNombre = mtNombre;
    }

    public double getMtCosto() {
        return mtCosto;
    }

    public void setMtCosto(double mtCosto) {
        this.mtCosto = mtCosto;
    }

    @XmlTransient
    public List<Multa> getMultaList() {
        return multaList;
    }

    public void setMultaList(List<Multa> multaList) {
        this.multaList = multaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (mtId != null ? mtId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MultaTipo)) {
            return false;
        }
        MultaTipo other = (MultaTipo) object;
        if ((this.mtId == null && other.mtId != null) || (this.mtId != null && !this.mtId.equals(other.mtId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return mtNombre + " [" + mtCosto + "]";
    }
    
}
